# -*- coding: utf-8 -*-
"""
Author:duan
Date: 2021/3/4 22:34
"""
import pika

credentials = pika.PlainCredentials('guest', 'guest')
params = pika.ConnectionParameters(host='127.0.0.1', credentials=credentials)
connection = pika.BlockingConnection(params)
# 队列连接通道
channel = connection.channel()
# 声明队列
channel.queue_declare(queue='hello-123456', durable=True)
channel.basic_publish(exchange='', routing_key='hello-123456',
                      properties=pika.BasicProperties(delivery_mode=2),
                      body=b'Hello World!')
print("[*] Send 'Hello World!'")
connection.close()
